<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="Scripts/jquery-1.9.0.js"></script>
<script type="text/javascript" src="Scripts/jquery.validate.min.js"></script>
<script type="text/javascript">
 
$.validator.setDefaults(
{
	//submitHandler: function() { alert("submitted!"); }
});

$().ready(function() 
{
	$("#FormText").validate({
		rules: 
		{
			testo: 
			{
				required: true,
				minlength: 2
			}
		},
		messages:
		{
			testo:
			{
				required:"Inserire un messaggio non vuoto",
				minlength: "Messaggio troppo corto"
			}
		}
	});
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Nuovo Messaggio</title>
</head>
<body>
   <form name="bacheca" method="post" action="BachecaServlet">
      <input type="hidden" name="username" value="<%=request.getParameter("username") %>">
      <input type="hidden" name="nome" value="<%=request.getParameter("nome") %>">
      <input type="hidden" name="cognome" value="<%=request.getParameter("cognome") %>">
   </form>
   <form name="notifiche" method="post" action="NotificheServlet">
      <input type="hidden" name="username" value="<%=request.getParameter("username") %>">
      <input type="hidden" name="nome" value="<%=request.getParameter("nome") %>">
      <input type="hidden" name="cognome" value="<%=request.getParameter("cognome") %>">
   </form>
    <form name="ricerca" method="post" action="Ricerca.jsp">
      <input type="hidden" name="id" value="<%=request.getParameter("username") %>">
      <input type="hidden" name="nome" value="<%=request.getParameter("nome") %>">
      <input type="hidden" name="cognome" value="<%=request.getParameter("cognome") %>">
   </form>
   <p>
   <a href="javascript:document.bacheca.submit()">Bacheca</a>
   <a href="javascript:document.notifiche.submit()">Notifiche</a>
   <a href="MostraMioProfiloServlet?id=<%= request.getParameter("username") %>"><%= request.getParameter("nome") %><%= request.getParameter("cognome") %></a>
   <a href="javascript:document.ricerca.submit()">Ricerca</a>
   <a href="LogoutServlet?username=<%= request.getParameter("username")%>&user=utente">Logout</a>
   </p>

<form name="FormText" id="FormText" method="post" action="NuovoMsgServlet">
   <p><textarea rows="5" cols="50" name="testo" id="testo">Nuovo messaggio</textarea></p>
   <input type="hidden" name="username" value="<%=request.getParameter("username") %>">
   <p><input type="submit" value="Scrivi"></p>
</form>
</body>
</html>